﻿using HK.Core.Common;
using HK.Core.Utils;

namespace HK.Core.Load.Protocol.Data
{
    
    /// <summary>
    /// 接口 : 资产信息
    /// </summary>
    public interface IAssetInfo : IAssetBase
    {
        /// <summary>
        /// AssetKey
        /// </summary>
        string AssetKey { get; }
        
        /// <summary>
        /// 文件后缀
        /// </summary>
        string Extension { get; }
        
        /// <summary>
        /// 完整Key
        /// <para>* 包含后缀名</para>
        /// </summary>
        string FullKey { get; }
        
        /// <summary>
        /// 资产类型
        /// </summary>
        AssetFileType AssetType { get; }
        
        /// <summary>
        /// AbId
        /// </summary>
        string AbId { get; }
        
#region Atlas

        /// <summary>
        /// 图集标志位
        /// </summary>
        bool IsAtlas { get; }

        /// <summary>
        /// Include in build
        /// <para>* 当且仅当图集时有效</para>
        /// </summary>
        bool IncludeInBuild { get; }

#endregion

        /// <summary>
        /// 设定信息
        /// </summary>
        /// <param name="iAssetKey">AssetKey</param>
        /// <param name="iOptions">选项</param>
        /// <param name="iAbId">Ab Id</param>
        /// <param name="iAsync">异步标志位</param>
        /// <param name="iCoolTime">倒计时冷却时间(默认 : 30秒)</param>
        void SetInfo(string iAssetKey, int iOptions, string iAbId = null, bool iAsync = false, float iCoolTime = Const.DefaultCoolTime);

    }

    /// <summary>
    /// 接口 : 资产信息
    /// </summary>
    /// <typeparam name="TAsset">资产类型</typeparam>
    public interface IAssetInfo<TAsset> : IAssetInfo where TAsset : UnityEngine.Object
    {
        
        /// <summary>
        /// 资产类型
        /// </summary>
        TAsset Asset { get; }

        /// <summary>
        /// 设定Asset
        /// </summary>
        /// <param name="iAsset">Asset</param>
        /// <param name="iFrom">加载来源</param>
        /// <param name="iIncludeInBuild">Include In Build</param>
        void SetAsset(TAsset iAsset, LoadFrom iFrom, bool iIncludeInBuild = false);

    }
}